<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>分组管理</title>
    <script type="text/javascript" src="/js/jquery.js"></script>
</head>
<body>

<ul id = "J_list">
    <li> <div>默认分组</div> </li>
</ul>

<script>
    $(function(){
        getGroupList();
    });
    function getGroupList(){
        var uid = "${uid}";
        var data = {uid:uid};
        var url = "/group/group_list";
        $.ajax({
            type: "POST",
            dataType: 'json',
            async: false,
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(data),
            url: url,
            success: function(res){
                if(res.code = "200"){
                    var list = res.data.list;
                    if(list.length>0){
                        for (var i =0;i<list.length;i++){
                            var shtml = '<li> '+list[i]['id']+'<div>'+list[i]['name']+'</div> </li>';
                            $("#J_list").append(shtml);
                        }
                    }
                }else{
                    alert(res.msg);
                }
            },
            error: function(e){

            },
            complete: function(e){

            }
        });
    }

</script>
</body>
</html>
